package com.mycode.controller;

import com.mycode.domain.ResponseResult;
import com.mycode.service.TStorageService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author Zengsh123
 * @date 2020-03-17 16:17
 */
@RestController
public class StorageController {
    @Resource
    private TStorageService storageService;

    @PostMapping(value = "storage/decrease")
    public ResponseResult decrease(@RequestParam("productId") Long productId,
                                   @RequestParam("count") Integer count) {
        storageService.decrease(productId,count);
        return new ResponseResult(200, "扣减库存成功");
    }
}
